package com.englishtest.city.service;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;


public class CityServiceFactory {
	private static CityService cityService = null;

	public static synchronized CityService getCityService() {
		if(cityService == null){
			ApplicationContext ct = WebApplicationContextUtils.getWebApplicationContext(
					ServletActionContext.getServletContext());
			cityService = (CityService)ct.getBean("cityService");
		}
		return cityService;
    }
}
